.select {
  position: relative;
  display: inline-block;
  font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
  width: 200px;
  user-select: none;
  z-index: 100;
}

.selectHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  border: 2px solid transparent;
  background-clip: padding-box;
  font-weight: 500;
  letter-spacing: 0.5px;
  pointer-events: auto;

  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 100%);
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
  }

  &:hover::before {
    opacity: 1;
  }
}

.selectValue {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.arrow {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid currentColor;
  margin-left: 8px;
  transition: transform 0.3s ease;

  &.up {
    transform: rotate(180deg);
  }
}

.primary {
  .selectHeader {
    background: var(--theme-primary-gradient);
    color: #fff;
    box-shadow: 0 4px 15px var(--theme-primary-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border: none;

    ::after {
      content: '';
      /* 伪元素必须要有content */
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      /* 在伪元素上设置“边框”，实际上是覆盖一层透明背景 */
      border: 2px solid rgba(255, 255, 255, 0.2);
      border-radius: 9999px;
      /* 圆角与按钮一致 */
      box-sizing: border-box;
      /* 确保边框向内绘制，不影响尺寸 */
      pointer-events: none;
      /* 让鼠标事件可以穿透伪元素，点击到下面的按钮 */
    }

    &:hover {
      transform: translateY(-2px);
      box-shadow: 0 6px 20px var(--theme-primary-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.4);
      background: var(--theme-primary-gradient);
    }
  }
}

.secondary {
  .selectHeader {
    background: var(--theme-secondary-gradient);
    color: var(--theme-secondary-text);
    box-shadow: 0 4px 15px var(--theme-secondary-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.4);

    &:hover {
      transform: translateY(-2px);
      box-shadow: 0 6px 20px var(--theme-secondary-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.6);
      background: var(--theme-secondary-gradient);
    }
  }
}

.outline {
  .selectHeader {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.7) 100%);
    color: var(--theme-primary-main);
    border: 2px solid transparent;
    background-clip: padding-box;
    position: relative;

    &::after {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      border-radius: inherit;
      padding: 2px;
      background: var(--theme-outline-border);
      mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
      mask-composite: xor;
      -webkit-mask-composite: xor;
      z-index: -1;
    }

    &:hover {
      transform: translateY(-2px);
      box-shadow: 0 6px 20px var(--theme-primary-shadow);
      background: linear-gradient(135deg, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0.9) 100%);
    }
  }
}

.small {
  width: 160px;

  .selectHeader {
    padding: 6px 12px;
    font-size: 12px;
    height: 32px;
    border-radius: 16px;
  }
}

.medium {
  width: 200px;

  .selectHeader {
    padding: 10px 16px;
    font-size: 14px;
    height: 40px;
    border-radius: 20px;
  }
}

.large {
  width: 240px;

  .selectHeader {
    padding: 14px 20px;
    font-size: 16px;
    height: 48px;
    border-radius: 24px;
  }
}

.disabled {
  cursor: not-allowed;
  opacity: 0.6;

  .selectHeader {
    cursor: not-allowed;
    transform: none !important;
  }
}

.selectDropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 99999;
  margin-top: 5px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  animation: slideDown 0.3s ease-out;
  pointer-events: auto;
  transform: translateZ(0);
  /* 启用硬件加速 */
}

.selectOptions {
  list-style: none;
  margin: 0;
  padding: 8px 0;
  max-height: 200px;
  overflow-y: auto;
}

.selectOption {
  padding: 10px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  color: #333;
  display: flex;
  align-items: center;
  pointer-events: auto;
  position: relative;
  z-index: 100000;
  transform: translateZ(0);
  /* 启用硬件加速 */

  &:hover,
  &.selected {
    background: linear-gradient(135deg, rgba(var(--theme-primary-light-rgb, 255, 154, 205), 0.1) 0%, rgba(var(--theme-primary-main-rgb, 255, 188, 193), 0.1) 100%);
    color: var(--theme-primary-main);
  }

  &.selected {
    font-weight: 600;
  }

  &.disabled {
    color: #aaa;
    cursor: not-allowed;

    &:hover {
      background: none;
      color: #aaa;
    }
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 主题特定颜色变量 */
.theme-pink {
  --theme-secondary-text: #6B46C1;
  --theme-primary-main: #FF9ACD;
  --theme-primary-light: #FF9ACD;
  --theme-primary-light-rgb: 255, 154, 205;
  --theme-primary-main-rgb: 255, 188, 193;
}

.theme-blue {
  --theme-secondary-text: #2C5282;
  --theme-primary-main: #4682B4;
  --theme-primary-light: #87CEEB;
  --theme-primary-light-rgb: 135, 206, 235;
  --theme-primary-main-rgb: 70, 130, 180;
}

.theme-purple {
  --theme-secondary-text: #6B46C1;
  --theme-primary-main: #9370DB;
  --theme-primary-light: #DDA0DD;
  --theme-primary-light-rgb: 221, 160, 221;
  --theme-primary-main-rgb: 147, 112, 219;
}

/* 添加闪烁动画效果 */
@keyframes shimmer {
  0% {
    background-position: -200% center;
  }

  100% {
    background-position: 200% center;
  }
}

.select.glow {
  .selectHeader::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: var(--theme-glow-gradient);
    background-size: 400% 400%;
    border-radius: inherit;
    z-index: -1;
    animation: shimmer 3s ease infinite;
    opacity: 0.7;
  }
}